package id.xsis.project.blog.entity;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@SuppressWarnings("serial")
@Entity
@Table(name = "tbl_user", catalog="blog-project", uniqueConstraints={
		@UniqueConstraint(columnNames="user_id"),
})

public class User implements Serializable{

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name="user_id", nullable=false)
	private Integer user_id;
	
	@Column(name = "username")
	private String userName;

	@Column(name = "password")
	private String password;
	
	@Column(name="enabled")
	boolean enabled;
	
	public Integer getUserId() {
		return user_id;
	}
	
	/*@OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST,CascadeType.MERGE}, mappedBy = "users")
	private Set<UserRoles> userroles = new HashSet<UserRoles>(0);
	
	public Set<UserRoles> getUserroles() {
		return userroles;
	}*/
	
	public boolean isEnabled() {
		return enabled;
	}

	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}

	/*public void setUserroles(Set<UserRoles> userroles) {
		this.userroles = userroles;
	}*/
	
	
	
	public void setId(Integer userId) {
		this.user_id = userId;
	}
	

	public String getUserName() {
		return userName;
	}

	public void setUserName(String UserName) {
		this.userName = UserName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password= password;
	}

}
